<div class="modal fade modalDelete" tabindex="-1" role="dialog" aria-labelledby="modalDeleteLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="modalDeleteLabel">删除</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        确认删除么？
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">关闭</button>
        <button type="button" class="btn btn-primary">提交</button>
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">
$(function(){
    $('.modalDelete').on('show.bs.modal', function (event) {
        var row = $(event.relatedTarget).parent().parent();
        var id = row.find('input').val();
        $('.btn-primary').unbind('click').click(function () {
            $.ajax({
                type: 'DELETE',
                dataType: 'json',
                url: '/api<?php echo $this->uri;?>/v1/id/'+id,
                data: {'token': '<?php echo $_SESSION[APP_NAME]['security']['token'];?>'},
                success: function(data){
                    if (data.code === 10000) {
                        $('.modalDelete').modal('hide');
                        row.remove();
                        return true;
                    }
                    alert(data.id +':'+ data.msg);
                }
            });
        });
    });
});
</script>